/-editor
/-files
/-imports ...
/-imports/acorn ...
acorn.js
acorn_loose.js
walk.js
/-imports/codemirror
/-imports/knockout
/-imports/tern
/-imports/typescript
/-imports/zip.js
/-layout
/-typings
TypeScriptService.ts
ko.ts
persistence.ts
shell.ts
teapo.html
teapo.js
teapo.ts
x
331
  base.BinaryExpression = base.AssignmentExpression = base.LogicalExpression = function(node, st, c) {
 
1
// AST walker module for Mozilla Parser API compatible trees
2
3
(function(mod) {
4
  if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS
5
  if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD
6
  mod((this.acorn || (this.acorn = {})).walk = {}); // Plain browser env
7
})(function(exports) {
8
  "use strict";
9
10
  // A simple walk is one where you simply specify callbacks to be
11
  // called on specific nodes. The last two arguments are optional. A
12
  // simple use would be
13
  //
14
  //     walk.simple(myTree, {
15
  //         Expression: function(node) { ... }
16
  //     });
17
  //
18
  // to do something with all expressions. All Parser API node types
19
  // can be used to identify node types, as well as Expression,
20
  // Statement, and ScopeBody, which denote categories of nodes.
21
  //
22
  // The base argument can be used to pass a custom (recursive)
23
  // walker, and state can be used to give this walked an initial
24
  // state.
25
  exports.simple = function(node, visitors, base, state) {
26
    if (!base) base = exports.base;
27
    function c(node, st, override) {
28
      var type = override || node.type, found = visitors[type];
29
      base[type](node, st, c);
30
      if (found) found(node, st);
31
    }
32
    c(node, state);
33
  };
34
35
  // An ancestor walk builds up an array of ancestor nodes (including
36
  // the current node) and passes them to the callback as the state parameter.
37
  exports.ancestor = function(node, visitors, base, state) {
38
    if (!base) base = exports.base;
39
    if (!state) state = [];
40
    function c(node, st, override) {
41
      var type = override || node.type, found = visitors[type];
42
      if (node != st[st.length - 1]) {
43
        st = st.slice();
44
        st.push(node);
45
      }
46
      base[type](node, st, c);
47
      if (found) found(node, st);
48
    }
49
    c(node, state);
50
  };
51
52
  // A recursive walk is one where your functions override the default
53
  // walkers. They can modify and replace the state parameter that's
54
  // threaded through the walk, and can opt how and whether to walk
55
  // their child nodes (by calling their third argument on these
56
  // nodes).
57
  exports.recursive = function(node, state, funcs, base) {